package com.alks.function.mapper.finance.statement;


import com.alks.entity.data.entity.DhDeptProdStatusD;
import com.alks.entity.data.entity.YearDay;
import com.alks.function.data.dto.finance.statement.DhDeptProdStatusMDto;
import com.alks.function.data.dto.finance.statement.DhDeptProdStatusMHorizontalDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface GenerateProdReportMapper {


    /*获取指令产量明细*/
    List<DhDeptProdStatusMDto> getMonthProd(String year, String companyId);

    /*获取部门一年每个月的产量明细*/
    List<DhDeptProdStatusMHorizontalDto> getDeptYearAndMonthProd1(String year, String companyId);

    List<DhDeptProdStatusMHorizontalDto> getDeptYearAndMonthProd(String year, String companyId);

    int deleteDhDeptProdStatusByCompanyAndMonth(String yearMonth);

    int deleteDhDeptProdStatusMByCompanyAndMonth(String yearMonth);

    int deleteDhDeptProdStatusDByCompanyAndMonth( String yearMonth);

    /*检查 DhDeptProdStatusM 是否已有年月记录*/
    int countByCompany( String yearMonth);

    /*插入 DhDeptProdStatusM 初始数据（插入dh_v_prod_dept和 yp_year_month 的数据）*/
    void insertMonthInitialData(String year,  String yearMonth);

    /*插入DhDeptProdStatusD 初始数据（现有月份的数据）*/
    void insertDayInitialData(String year, String yearMonth);

    void insertMonthInitialData2();
    void insertDayInitialData2();

    /*插入日志记录*/
    void insertDhNewExecuteLog(String step);

    /*更新生产数量*/
    void updateProdQty(String companyId, int prodSeq, int deptLevel, String yearAndMonth);

    /*统计当月入库的总针车产量*/
    float countStitchByMonth(String companyId, String yearAndMonth);

    /*查询 YP_YEAR_MONTH 是否存在今年的数据*/
    int countYpYearMonth(String year);

    int countYpYearDay(String year);

    void insertYpYearMonthBatch(String year, List<String> list);

    /**
     * 查询当月的日报量
     */
    List<DhDeptProdStatusD> getDailyProd(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);

    /**
     * 删除指定日期的日报表数据
     */
    void deleteByDate(@Param("time") LocalDateTime time, @Param("companyId") String companyId);

    /**
     * 获取指定日期的日报表数据
     */
    void pull(@Param("time") LocalDateTime time, @Param("companyId") String companyId);

    void initMonthProd();

    int deleteDhDeptProdByYearMonth(String yearMonth);

    void insertMonthProd(String yearMonth);

    /*更新当月产量*/
    void updateMonthProd(String yearMonth);

    void updateMonthProd2();

    /*更新当月日产量*/
    void updateDayProd(String yearMonth);


    void updateDayProd2();


    void insertYpYearDayBatch(String year, List<YearDay> list);

    List<String> getMonthHeadList(String year);
}
